'use client'

import { Spin } from 'antd'
import { LoadingOutlined } from '@ant-design/icons'

interface LoadingSpinnerProps {
  spinning?: boolean
  tip?: string
}

export default function LoadingSpinner({ spinning = false, tip = '加载中...' }: LoadingSpinnerProps) {
  if (!spinning) return null

  return (
    <div style={{
      position: 'fixed',
      top: 0,
      left: 0,
      right: 0,
      bottom: 0,
      background: 'rgba(255, 255, 255, 0.8)',
      display: 'flex',
      justifyContent: 'center',
      alignItems: 'center',
      zIndex: 10000,
    }}>
      <Spin 
        indicator={<LoadingOutlined style={{ fontSize: 24 }} spin />}
        tip={tip}
        size="large"
      />
    </div>
  )
} 